home *** CD-ROM | disk | FTP | other *** search
/ Mac Easy 2010 May / Mac Life Ubuntu.iso / casper / filesystem.squashfs / usr / lib / python2.6 / dist-packages / checkbox / registries / map.pyc (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2009-10-12  |  1.5 KB  |  36 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. import types
  5. from checkbox.lib.cache import cache
  6. from checkbox.registry import Registry
  7.  
  8. class MapRegistry(Registry):
  9.     '''Registry for maps.
  10.  
  11.     The default behavior is to express the given maps as a tree of items.
  12.     '''
  13.     
  14.     def __init__(self, map = { }):
  15.         super(MapRegistry, self).__init__()
  16.         self._map = map
  17.  
  18.     
  19.     def __str__(self):
  20.         strings = [ '%s: %s' % (k, v) for k, v in self._map.items() ]
  21.         return '\n'.join(strings)
  22.  
  23.     
  24.     def items(self):
  25.         items = []
  26.         for key, value in self._map.items():
  27.             if type(value) is types.DictType:
  28.                 value = MapRegistry(value)
  29.             
  30.             items.append((key, value))
  31.         
  32.         return items
  33.  
  34.     items = cache(items)
  35.  
  36.